package com.deyuanyun.pic.insp.controller.statistics;

import com.deyuanyun.pic.common.util.ResponseUtil;
import com.deyuanyun.pic.common.util.ajax.AjaxSupport;
import com.deyuanyun.pic.settings.controller.AbstractBaseController;
import com.deyuanyun.pic.settings.domain.base.Code;
import com.deyuanyun.pic.insp.service.statistics.OtherDefectService;
import com.deyuanyun.pic.settings.support.biz.CodeUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;

/**
 * 其他缺陷统计
 *
 * @author       // scalpel.王敏
 * @version      // [v1.0] 创建时间（2016/10/14 9:25）
 * @see         // 引用的类
 * Method List:
 *         1.----------------getBase 返回页面
 *         2.----------------findStatistics 统计查询
 * History:                           // 历史修改记录           (如果有修改别人的类，必须)   [修改人][时间][修改描述]
 */

@Controller
@RequestMapping("/insp/statistics/OtheDefectController")
public class OtherDefectController extends AbstractBaseController {
	
	@Resource
	private OtherDefectService otherDefectService;

	/**
	 * 
		 * 
		 *@创建者:严祥
		 *@创建时间：2015年9月25日上午11:10:38
		 *@方法说明:返回内检测其他缺陷查询主页
		 *@参数:@return
		 *@return:ModelAndView
		 *
	 */
	@RequestMapping("/getBase")
	public ModelAndView getBase(){
		ModelAndView mv=new ModelAndView();
		//查询管道名称 
		List lineList=lineService.getLine();
		mv.addObject("lineList", lineList);
		List<Code> data= CodeUtil.getCodeList("DENT_TYPE");
		for(Code c:data)
		{
			if(c.getMinorCode()!=null && c.getId() != null){
				mv.addObject(c.getMinorCode(), c.getId());
			}
			
		}
		data=CodeUtil.getCodeList("FEATURE_TYPE");
		for(Code c:data)
		{
			if(c.getMinorCode()!=null && c.getId() != null){
				mv.addObject(c.getMinorCode(), c.getId());
			}
			
		}
		mv.setViewName("/insp/statistics/other");
		return mv;
	}
	

	
	/**
	 * 
	  * 查询凹陷柱状图
	  * @author 王敏
	  * @time 2015年10月15日下午4:23:20
  	  * @param  param:检测任务ID
			taskSegmentId:检测管段ID
			lineId:管道ID
			segmentId:管段ID
	  * @return                       
	  * @see                         
	  *
	 */
	@ResponseBody
	@RequestMapping("/findStatistics")
	public void findStatistics(@RequestParam HashMap<String, Object> param,HttpServletResponse response){

		AjaxSupport.sendSuccessText("",otherDefectService.findStatistics(param));
	}
	
	
}
